home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19990725-20000114 / 000326_news@columbia.edu _Wed Dec 8 03:34:33 1999.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id DAA17419
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Wed, 8 Dec 1999 03:34:33 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id DAA24491
  7.     for kermit.misc@watsun.cc.columbia.edu; Wed, 8 Dec 1999 03:20:33 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. Date: Wed, 8 Dec 1999 00:21:08 -0700 
  10. From: <Use-Author-Address-Header@[127.1]>
  11. Message-ID: <TCPSMTP.19.12.8.0.21.8.2375661496.5936655@kincyb.com>
  12. Subject: ANSI stripping script
  13. Organization: mail2news@nym.alias.net
  14. To: kermit.misc@columbia.edu
  15.  
  16.  
  17. (previously posted to the old seder mailing list,
  18. now sed users.)
  19.  
  20. The following sed script I've sometimes found usefull
  21. to strip ANSI control sequences out of C-Kermit
  22. log files if needed.  Maybe there is some better way
  23. to do this, and I don't claim this to be perfect,
  24. but it seems to work about as good as a DOS program
  25. I tried out for the purpose, and is much more portable.
  26.  
  27. #!/bin/sed -f
  28. #
  29. #    ANSI2TXT.SED
  30. #
  31. #   sed script to strip out ANSI escape sequences
  32. #
  33. #      Dallas E. Legan II 04/12/98
  34. #      dallasii@kincyb.com
  35. #      leganii@surfree.com
  36. #
  37. #
  38. #      based on ANSI escape sequences listed in
  39. #      'Writing DR DOS Batch Files' by Ronnie Richardson
  40. #      Windcrest/McGraw-Hill, (c) 1993, pages 169-170
  41. #
  42. #
  43. #     Replace: 'ESC' with ASCII 27, the 'escape character'
  44. #              ^M, ^@, ^H with their control characters
  45. #                         on the last line
  46. #              for a functional script.
  47. #
  48. :punct
  49. #  worked with GNU sed 2.05 for OS/2:
  50. #  s/ESC[[=?c]/ESC/g
  51. #  
  52. #  worked with GNU sed 3.02 with Debian 2.1 Linux:
  53. s/ESC[[=?c]/ESC/g
  54. t punct
  55.  
  56. s/ESC[0-9r]*[:;]/ESC/g
  57. t punct
  58.  
  59. s/ESC[0-9fH]*[A-Za-z]//g
  60. s/[ESC^A^H]//g
  61.  
  62.  
  63.  
  64. Regards, Dallas E. Legan 
  65.          dallasii
  66.                  @
  67.                   kincyb
  68.                         .
  69.                           com
  70.          leganii
  71.                 @
  72.                  surfree
  73.                         .
  74.                          com
  75.  
  76.